<template>
 <div>
 <header class="bar bar-nav" >
    <a class="button button-link button-nav pull-left" v-link="{path: '/home', replace: true}">
    <span class="icon icon-left"></span>
    </a>
    <h1 class="title">会员主页</h1>
  </header>
<div class="content banner">
    <div class="logo">
        <div class="logo_img">
            <img v-bind:src='user.img' class="img-responsive" style="border:solid 1px #fff;border-radius: 50px;overflow:hidden;" width="64" height="64">
	</div>
	<span>会员类型: {{huiyuanType}}</span>
    </div>
  <div class="list-block">
    <ul>
     <li>
        <a class="item-content item-link" v-link="{ path: '/user/profile', query: {uid: user.uid}}">
        <div class="item-media"><span class="icon icon-star"></sapn></div>
        <div class="item-inner">
          <div class="item-title">修改资料</div>
        </div>
        </a>
      </li>
      <li>
        <a class="item-content item-link" v-link="{ path: '/user/assist', query: {uid: user.uid}, replace: true}">
        <div class="item-media"><span class="icon icon-star"></sapn></div>
        <div class="item-inner">
          <div class="item-title">个人助理</div>
        </div>
        </a>
      </li>
       <li>
        <a class="item-content item-link" v-link="{path:'/travel/mytravel',replace: false}">
        <div class="item-media"><span class="icon icon-star"></sapn></div>
        <div class="item-inner">
          <div class="item-title">我的活动</div>
        </div>
        </a>
      </li>
       <li>
        <a class="item-content item-link"  v-link="{ path: '/user/right', replace: true}">
          <div class="item-media"><span class="icon icon-star"></sapn></div>
          <div class="item-inner">
            <div class="item-title">我的eMAN福利</div>
          </div>
        </a>
      </li>
   <!--    <li>
        <a class="item-content item-link"  v-link="{ path: '/user/history', replace: true}">
          <div class="item-media"><span class="icon icon-star"></sapn></div>
          <div class="item-inner">
            <div class="item-title">我的足迹</div>
          </div>
        </a> -->
      </li>
      <li>
        <a class="item-content item-link"  v-link="{ path: '/user/introduction', replace: true}">
          <div class="item-media"><span class="icon icon-star"></sapn></div>
          <div class="item-inner">
            <div class="item-title">会员卡说明</div>
          </div>
        </a>
      </li>
      <li>
        <a class="item-content item-link"  v-link="{ path: '/user/userupgrade-0', replace: false}">
          <div class="item-media"><span class="icon icon-star"></sapn></div>
          <div class="item-inner">
            <div class="item-title">在线会员升级</div>
          </div>
        </a>
      </li>
     
    </ul>
  </div>
</div>
</div>
</template>

<script>
import $ from 'zepto'
export default {
  data () {
    return {
      code: '',
      apiUrl: 'http://creatgo.com/oec/login?method=login-wx&code=',
      user: {
        uid: '',
        openid: '',
        type: 0,
        assistid: '',
        phone: '',
        email: '',
        school: '',
        grade: '',
        major: '',
        address: '',
        name: '',
        img: '',
        nickname: ''
      }
    }
  },
  route: {
    data () {
      this.$set('code', this.$route.query.code)
      console.log(this.code)
      this.$http.get(this.apiUrl + this.code).
      then(function(response) {
        this.$set('user', response.json().user)
        $.sign.uid = this.user.uid
        console.log($.sign.uid)
        $.sign.openid = this.user.openid
        console.log($.sign.openid)
        this.$set('code', '')
        $.user = this.user
      })
    }
  },
  computed: {
    huiyuanType: function() {
      if (this.user.type === 1) {
        console.log('1.....')
        return '英盟MT'
      }
      else if (this.user.type === 2) {
        console.log('2.....')
        return '英盟ME'
      }
      else if (this.user.type === 3) {
        console.log('3.....')
        return '英盟PLUS'
      }
      return '普通会员'
    }
  }
}
</script>

<style scoped>
.banner .logo {
  background-color:white;
  border-radius: 10px;
  width: 100%;
  height: 110px;
  padding: 20.2666654px 21.333332px 5.333333px;
  box-shadow: 0 .0rem .8rem rgba(0,0,0,.3);
}
.banner .logo .logo_img {
  margin-top: 0px;
  width: 58.666663px;
  height: 58.666663px;
  display: inline-block;
}
li{
 height:3rem;
}
</style>
